package com.ad_hccm.dao.AllergyHistory;

import com.ad_hccm.domain.AllergyHistory.AllergyHistory;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * TODO 过敏史Dao
 */
@Mapper
public interface AllergyHistoryDao {
    @Insert("insert into allergy_history value(#{id}, #{medicineAllergy}, #{medicine}, #{foodAllergy}, #{food}, #{contactAllergy}, #{contact})")
    public boolean save(AllergyHistory allergyHistory);

    @Update("update allergy_history set medicineAllergy = #{medicineAllergy}, medicine = #{medicine}, foodAllergy = #{foodAllergy}, food = #{food}, contactAllergy = #{contactAllergy}, contact = #{contact} where id=#{id}")
    public boolean update(AllergyHistory allergyHistory);

    @Select("select * from allergy_history where id=#{id}")
    public AllergyHistory getById(String id);

    @Select("select * from allergy_history")
    public List<AllergyHistory> getAll();
}
